package gcj2011.round1c;

import common.AbstractRunner;
import common.AbstractRunner.SIZE;

public class A  extends AbstractRunner {
	
	public void handleCase(int caseNumber) throws Exception {
		int[][] a = new int[50][50];
		int r = scanner.nextInt();
		int c = scanner.nextInt();
		scanner.nextLine();
		for (int i = 0; i < r; i++) {
			String s = scanner.nextLine();
			for (int j = 0; j < c; j++) {
				a[i][j] = s.charAt(j) == '#' ? 1 : 0;
			}
		}
		
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				if (a[i][j] == 1) {
					if (i==r-1 || j == c-1 || a[i+1][j] != 1 || a[i][j+1] != 1 || a[i+1][j+1] != 1) {
						out.write("\nImpossible\n");
						return;
					}
					a[i][j] = 2;
					a[i+1][j] = 3;
					a[i][j+1] = 4;
					a[i+1][j+1] = 5;
				}
			}
		}
		
		for (int i = 0; i < r; i++) {
			out.write("\n");
			for (int j = 0; j < c; j++) {
				switch (a[i][j]) {
				case 0:
					out.write('.');
					break;
				case 2:
					out.write('/');
					break;
				case 3:
					out.write('\\');
					break;
				case 4:
					out.write('\\');
					break;
				case 5:
					out.write('/');
					break;					
				default:
					throw new IllegalStateException("Cell ("+i+","+j+") value: "+a[i][j]);
				}
			}			
		}
		out.write("\n");
	}
	
	public static void main(String[] args) throws Exception {
		new A().init(SIZE.large).execute();
	}

}
